﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NetCoreCMS.IServices;

namespace NetCoreCMS.Web.Areas.WebApi.Controllers
{
    public class Get_Article_CategoryController : BaseController
    {
        public IArticle_categoryService _article_category { get; set; }
        [HttpGet]
        public IActionResult Get(int id = 0, int channel_id = 1)
        {
            var sysConfig = Common.XMLConfig.Sysconfig.loadConfig(_env.ContentRootPath);
            var list = _article_category.GetChildList(0, id, channel_id);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].img_url = sysConfig.weburl + list[i].img_url;
            }
            return Ok(new { status = 1, list = list });
        }
    }
}